package zhang.lao.console.controller.wn;/**
 * Created by zhangqin on 2017/9/18.
 */

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import zhang.lao.service.console.WnMachineLinkService;
import zhang.lao.pojo.console.req.WnMachineDeviceLinkReq;
import zhang.lao.pojo.console.req.WnMachineLinkQuery;
import zhang.lao.pojo.console.req.WnMachineToolLinkReq;
import zhang.lao.pojo.console.resp.BootStrapGridResp;
import zhang.lao.pojo.console.resp.HttpResult;

import javax.annotation.Resource;

/**
 * 农机关联管理
 *
 * @author
 * @create 2017-09-18 14:03
 **/

@Controller
public class WnMachineLinkController {

    @Resource
    private WnMachineLinkService wnMachineLinkService;

    @RequestMapping("/console/wn_machine_link/tool/json")
    public @ResponseBody
    BootStrapGridResp getMachineToolLink(WnMachineLinkQuery wnMachineLinkQuery){

       return wnMachineLinkService.getMachineToolList(wnMachineLinkQuery);
    }


    @RequestMapping("/console/wn_machine_link/auto/json")
    public @ResponseBody BootStrapGridResp getMachineautoLink(WnMachineLinkQuery wnMachineLinkQuery){

        return wnMachineLinkService.getMachineAutoList(wnMachineLinkQuery);
    }

    @RequestMapping("/console/wn_machine_link/gt06/json")
    public @ResponseBody BootStrapGridResp getMachinegt06Link(WnMachineLinkQuery wnMachineLinkQuery){

        return wnMachineLinkService.getMachinegt06List(wnMachineLinkQuery);
    }


    @RequestMapping("/console/wn_machine_link/select/page")
    public  String  getSelectPage(WnMachineLinkQuery wnMachineLinkQuery, ModelMap modelMap){

        modelMap.put("machine",wnMachineLinkQuery);
        return "console/wnMachine/wnMachine_select";
    }


    @RequestMapping("/console/wn_machine_link/gt06/link")
    public @ResponseBody
    HttpResult machinegt06Link(WnMachineDeviceLinkReq wnMachineDeviceLink){

        return wnMachineLinkService.machinegt06Link(wnMachineDeviceLink);
    }

    @RequestMapping("/console/wn_machine_link/auto/link")
    public @ResponseBody
    HttpResult machineAutoLink(WnMachineDeviceLinkReq wnMachineDeviceLink){

        return wnMachineLinkService.machineAutoLink(wnMachineDeviceLink);
    }

    @RequestMapping("/console/wn_machine_link/tool/link")
    public @ResponseBody
    HttpResult machineToolLink(WnMachineToolLinkReq wnMachineToolLink){

        return wnMachineLinkService.machineToolLink(wnMachineToolLink);
    }
}
